package com.sd365.permission.centre.api;

import com.sd365.common.core.annotation.stuffer.CommonFieldStuffer;
import com.sd365.common.core.annotation.stuffer.MethodTypeEnum;
import com.sd365.common.log.api.annotation.ApiLog;
import com.sd365.permission.centre.pojo.dto.CompanyDTO;
import com.sd365.permission.centre.pojo.query.CompanyQuery;
import com.sd365.permission.centre.pojo.query.IdVersionQuery;
import com.sd365.permission.centre.pojo.vo.CompanyVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @Author jxd
 * @Date 2020/12/12  1:12 下午
 * @Version 1.0
 * @Write For CompanyApi
 * @Email waniiu@126.com
 */
@CrossOrigin
@Api(tags = "公司管理 ",value ="/permission/centre/v1/company")
@RequestMapping(value = "/permission/centre/v1/company")
public interface CompanyApi {

    /**
     * 通用查询
     * @param companyQuery
     * @return
     */
    @ApiOperation(tags = "查询公司信息，分页", value = "")
    @GetMapping("")
    @ResponseBody
    @CommonFieldStuffer(methodType = MethodTypeEnum.QUERY)
    List<CompanyVO> commonQuery(CompanyQuery companyQuery);

    /**
     * @Title:
     * @Description: 批量更新
     * @Author: LiShiLong
     * @Date: 20:36 2020/12/15
     * @return:
     **/
    @ApiOperation(tags="批量更新",value="/batch")
    @PutMapping(value = "/batch")
    @ResponseBody
    @CommonFieldStuffer(methodType = MethodTypeEnum.UPDATE)
    Boolean batchUpdate(@RequestBody List<CompanyDTO> companyDTOS);

    /**
     * @param: 公司DTO
     * @return: 成功则true CommonResponse 应答码和消息统一参考基础框架
     * @see
     * @since
     */
    @ApiOperation(tags = "增加公司信息", value = "/add")
    @PostMapping(value = "/add")
    @ResponseBody
    Boolean add(@RequestBody @Valid CompanyDTO companyDTO);

    /**
     * @param:
     * @return:
     * @see
     * @since
     */
    @ApiOperation(tags = "删除公司信息", value = "/delete")
    @DeleteMapping(value = "/delete")
    @ResponseBody
    Boolean remove(@ApiParam(value = "当前行id", required = true) @RequestParam(value = "id", required = true) Long id,
                   @ApiParam(value = "当前行版本", required = true) @RequestParam(value = "version", required = true) Long version);


    /**
     * 批量删除Company
     *
     * @param idVersionQueryList Company批量删除列表
     * @return 成功返回true
     * @author Yan Huazhi
     * @date 2020/12/15 21:24
     * @version 0.0.1
     */
    @ApiOperation(tags = "批量删除公司信息", value = "/batch")
    @DeleteMapping(value = "/batch")
    @ResponseBody
    @CommonFieldStuffer(methodType = MethodTypeEnum.DELETE)
    Boolean removeBatch(@RequestBody List<IdVersionQuery> idVersionQueryList);

    /**
     * @return java.lang.Boolean
     * @Description 修改公司信息
     * @Param * @param companyDTO
     **/
    @ApiOperation(tags = "修改公司信息", value = "/modify")
    @PutMapping(value = "/modify")
    @ResponseBody
    Boolean modify(@Valid @RequestBody CompanyDTO companyDTO);

    @ApiOperation(tags = "通过id查询", value = "")
    @GetMapping(value = "{id}")
    @ResponseBody
    CompanyVO queryCompanyById(@PathVariable("id") Long id);


    /**
     * 复制company记录
     * @author Yan Huazhi
     * @date 2020/12/17 13:10
     * @version 0.0.1
     * @param id 公司id
     * @return
     */
    @ApiOperation(tags = "通过id查询", value = "/copy/{id}")
    @GetMapping(value = "/copy/{id}")
    @ResponseBody
    CompanyDTO copy(@PathVariable("id") Long id);

    /**
     * 更新单条启用状态
     * @author Yan Huazhi
     * @date 2020/12/18 9:20
     * @version 0.0.1
     * @param companyDTO 公司DTO
     * @return
     */
    @ApiOperation(tags = "通过id查询", value = "/status")
    @PutMapping(value = "/status")
    @ResponseBody
    Boolean status(@RequestBody CompanyDTO companyDTO);
}
